package com.util;

import my.myorm.tool.jdbc.DataSourceFactory;

import javax.sql.DataSource;

import my.myspring.tool.SpringBeanProxy;
import my.mylocal.tool.MyLocal;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 2010-4-7
 * Time: 19:21:09
 * To change this template use File | Settings | File Templates.
 */
public class MyDataSourceFactory implements DataSourceFactory {
    /*2011.01.07因使用两个数据源的时候会发生冲突，已经不再使用该方法获取数据源，直接在SQLExecutor中获取*/
    public DataSource getDataSource() throws Exception {
        String dsName=(String)MyLocal.get("datasource");
        if(dsName==null||dsName.trim().equals("")) dsName="DefaultDataSource";
        return (DataSource) SpringBeanProxy.getBean(dsName);
    }
}
